<template>
  <div class="headerBox">
    <van-nav-bar
     :title="props.title"
     :left-text="props.hasBack === true ? '返回' : '' "
     :left-arrow="props.hasBack && true"
     @click-left="onClickLeft"
    />
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { defineProps } from 'vue'
const router = useRouter()

const props = defineProps({
  title: { type: String },
  hasBack: { type: Boolean },
  path: { type: String }
})

const onClickLeft = () => {
  router.push(`/${props.path}`)
}
</script>

<style lang="scss" scoped>
   .van-nav-bar{
     background: #07c160;
     ::v-deep .van-nav-bar__title, .van-nav-bar__text, .van-icon {
       color: #fff;
     }
   }
   .headerBox{
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
  }
</style>
